/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restaurant.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author root
 */
@Entity
@Table(name = "employeeleave")
@XmlRootElement(name = "employeeleave")
@NamedQueries({
    @NamedQuery(name = "Employeeleave.findAll", query = "SELECT e FROM Employeeleave e"),
    @NamedQuery(name = "Employeeleave.findByEmployeeleaveID", query = "SELECT e FROM Employeeleave e WHERE e.employeeleaveID = :employeeleaveID"),
    @NamedQuery(name = "Employeeleave.findByDescription", query = "SELECT e FROM Employeeleave e WHERE e.description = :description"),
    @NamedQuery(name = "Employeeleave.findByDate", query = "SELECT e FROM Employeeleave e WHERE e.date = :date")})
public class Employeeleave implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "EmployeeleaveID")
    private Long employeeleaveID;
    @Column(name = "description")
    private String description;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @JoinColumn(name = "leavetype_LeavetypeID", referencedColumnName = "LeavetypeID")
    @ManyToOne(optional = false)
    private Leavetype leavetype;
    @JoinColumn(name = "employee_EmployeeID", referencedColumnName = "EmployeeID")
    @ManyToOne(optional = false)
    private Employee employee;

    public Employeeleave() {
    }

    public Employeeleave(Long employeeleaveID) {
        this.employeeleaveID = employeeleaveID;
    }

    public Long getEmployeeleaveID() {
        return employeeleaveID;
    }

    public void setEmployeeleaveID(Long employeeleaveID) {
        this.employeeleaveID = employeeleaveID;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Leavetype getLeavetype() {
        return leavetype;
    }

    public void setLeavetype(Leavetype leavetype) {
        this.leavetype = leavetype;
    }

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (employeeleaveID != null ? employeeleaveID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employeeleave)) {
            return false;
        }
        Employeeleave other = (Employeeleave) object;
        if ((this.employeeleaveID == null && other.employeeleaveID != null) || (this.employeeleaveID != null && !this.employeeleaveID.equals(other.employeeleaveID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.domain.Employeeleave[employeeleaveID=" + employeeleaveID + "]";
    }

}
